package com.eye.catcher.controller;
import com.eye.catcher.filter.SbCode;
import com.eye.catcher.param.CommonResponse;
import com.eye.catcher.param.ResponseData;
import com.eye.catcher.param.ResponseUtil;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/")
public class FallbackController {

    @RequestMapping("fallback/{name}")
    @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
    public ResponseData systemFallback(@PathVariable String name) {
        CommonResponse response = new CommonResponse();
        response.setCode(SbCode.SYSTEM_TIMEOUT.getCode());
        response.setMsg(name+": "+SbCode.SYSTEM_TIMEOUT.getMessage());
        return new ResponseUtil().setData(response);
    }
}